﻿using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using System.Data.Entity;
using System.Xml.Serialization;

namespace Sovigaz.DataProvider
{
    public partial class SovigazDbContext
    {
        public DbSet<DeliveryPlan> DeliveryPlans { get; set; }
    }

    [Table("DeliveryPlans")]
    public class DeliveryPlan : AuditableEntity
    {
        public DeliveryPlan()
        {
            Date = DateTime.Now;
            DeliveryPlanLines = new List<DeliveryPlanLine>();
            Orders = new List<Order>();
            OrderLines = new List<OrderLine>();
            DeliveryType = DeliveryPlanType.SO.ToString();
            Status = DeliveryPlanStatus.N.ToString();
        }

        [Key]
        public int DeliveryPlanID { get; set; }

        public int UserID { get; set; }

        public int LicensePlate { get; set; }

        public string DeliveryPlanCode { get; set; }

        public string DeliveryType { get; set; }

        public DateTime Date { get; set; }

        public int BocXep1 { get; set; }

        public int BocXep2 { get; set; }

        public int BocXep3 { get; set; }

        public string Status { get; set; }

        public string Description { get; set; }

        [XmlIgnore]
        [NotMapped]
        public ICollection<DeliveryPlanLine> DeliveryPlanLines { get; set; }

        [XmlIgnore]
        [NotMapped]
        public ICollection<Order> Orders { get; set; }

        [XmlIgnore]
        [NotMapped]
        public ICollection<OrderLine> OrderLines { get; set; }
    }

    public class DeliveryPlanComplex
    {
        public int DeliveryPlanID { get; set; }

        public int UserID { get; set; }

        public string UserName { get; set; }

        public string FullName { get; set; }

        public int LicensePlate { get; set; }

        public string DeliveryPlanCode { get; set; }

        public string DeliveryType { get; set; }

        public DateTime Date { get; set; }

        public int BocXep1 { get; set; }

        public int Bocxep2 { get; set; }

        public int Bocxep3 { get; set; }

        public string Status { get; set; }

        public string Description { get; set; }

        public string UpdatedName { get; set; }

        public DateTime UpdatedDate { get; set; }

        public bool IsDeleted { get; set; }
    }

    public enum DeliveryPlanStatus { N, C }

    public enum DeliveryPlanType { SO, IN }
}